package dao.impl;

import java.io.File;
import java.io.IOException;

import model.impl.SimulationdetailsImpl;

import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.resotc.dao.SimulationdetailsDAO;
import org.resotc.model.Simulationdetails;

public class SimulationdetailsDAOImpl extends AbstractXMLDAO implements SimulationdetailsDAO {
	
	private final static String indexFileName = "simulationdetails.xml";
	Simulationdetails simdetails;
	public SimulationdetailsDAOImpl() throws JDOMException,
			IOException {
		indexFile = new File(rootPath + "/" + indexFileName);

		loadXML();
		parseXML();
	}
	public Simulationdetails getSimulationdetails() {
		return this.simdetails;
	}

	private void parseXML() {
		Element rootElement = indexXMLInstance.getRootElement();
		Element SimulationdetailsElements = rootElement.getChild("simulationdetails");


		int duration;
		duration = Integer.valueOf(SimulationdetailsElements.getChildText("duration"));

		 simdetails = new SimulationdetailsImpl(duration);
	}
	public int getDuration() {
		// TODO Auto-generated method stub
		return this.getDuration();
	}
	
}
